package com.ibeeking.found.org.service.config;

import com.ibeeking.found.common.utils.UrlUtils;
import lombok.Data;
import org.apache.commons.lang.StringUtils;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.cloud.context.config.annotation.RefreshScope;
import org.springframework.context.annotation.Configuration;
import org.springframework.stereotype.Component;


@Data
@Component
@RefreshScope
@Configuration
public class FileConfig {

    @Value("${ibeeking.file.oss.host}")
    private String host;

    public String getOssUrl(String path) {
        return UrlUtils.addUrlDomainName(this.host, path);
    }

    public String getOssUrlWithoutHost(String path) {
        return UrlUtils.removeMallUrlDomainName(this.host, path);
    }

}
